import QtQuick 2.0

Item {
    property bool checked: false;
    property color backColor: "#F2F2F2";
    property color checkedBackColor: "#F54140";
    property color textColor: "#F54140";
    property color checkedTextColor: "#FFFFFF";
    property alias text: lable.text;
    property alias radius: rect.radius;
    signal clicked;

    id: root;

    Rectangle {
        id: rect;
        anchors.fill: parent;
        border.width: 1;
        border.color: "#F54140";
        color: checked ? checkedBackColor : backColor;

        Text {
            id: lable;
            clip: true;
            anchors.fill: parent;
            color: checked ? checkedTextColor : textColor;
            horizontalAlignment: Text.AlignHCenter;
            verticalAlignment: Text.AlignVCenter;
            text: qsTr("Button");
        }

        MouseArea {
            anchors.fill: parent;
            onClicked: {
                root.clicked();
            }
        }
    }
}
